package solution;


public class OfficialImpl implements task.Official {
	private Hat hat;
	private Robe robe;
	private Field field;
	
	OfficialImpl (Color robe, Color hat, Field field){
		this.hat = new Hat(hat);
		this.robe = new Robe(robe);
		this.field = field;
	}
	
	public Color getHat() {
		return hat.getColor();
	}

	public void setHat(Hat hat) {
		this.hat = hat;
	}

	public Color getRobe() {
		return robe.getColor();
	}

	public void setRobe(Robe robe) {
		this.robe = robe;
	}
	
	public Field getField() {
		return field;
	}
	
	public void setField(Field field) {
		this.field = field;
	}

	@Override
	public void moveNorth() {
		// counter z�hlt wie weit nach "oben" er �ber y noch gehen kann	
		int counter=0;
		// Man setzt eine Klassenvariable nicht in irgendeiner Methode. 
		BoardImpl board = (BoardImpl)field.getBoard();
		Coordination coord = field.getCoordinations();
		int x = coord.getX();
		int y = coord.getY();
	
		for(int i = y; i < board.getHeight(); i++){
			if(!board.hasWallNorth(x, i) && !board.hasBlock(x, 1+i) && !board.getField(x, i+1).isOccupied()){
				counter++;
			}
			else
			{
				break;
			}
		}
		board.moveOfficial(x, y, x, y+counter);
	}

	@Override
	public void moveEast() {
		
	}


	@Override
	public void moveSouth() {
		
	}


	@Override
	public void moveWest() {
		
}
}
